package com.le.tester.book.flightjava8.stream;

import java.util.stream.Stream;

/**
 * createTime：2025-08-14 16:20
 * description：并行流
 */
public class Parallel {
    public static long parallelSum(long n) {
        return Stream.iterate(1L, i -> i + 1)
                .limit(n)
                .parallel()
                .reduce(0L, Long::sum);
    }
}
